package com.yuqing.sentimentapp;

import android.content.Context;
import android.support.multidex.MultiDex;

import com.bumptech.glide.Glide;
import com.linkface.baselibrary.utils.LogUtil;
import com.linkface.baselibrary.utils.SharedPrefUtils;
import com.tencent.bugly.crashreport.CrashReport;
import com.yuqing.sentimentapp.base.BaseApplication;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by ShenHe on 2019/3/3.
 */

public class QYApplication extends BaseApplication {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        //初始化极光推送
        JPushInterface.setDebugMode(BuildConfig.DEBUG);
        JPushInterface.init(this);
        //保留最近的5条推送消息
        JPushInterface.setLatestNotificationNumber(this, 5);

        //初始化SharedPrefrence
        SharedPrefUtils.init(this);

        LogUtil.init(BuildConfig.DEBUG,"");

        CrashReport.initCrashReport(getApplicationContext(), "99d3efb5c9", BuildConfig.DEBUG);
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        Glide.with(this).onLowMemory();
    }

    @Override
    public void onTrimMemory(int level) {
        super.onTrimMemory(level);
        if (level == TRIM_MEMORY_UI_HIDDEN) {
            Glide.with(this).onLowMemory();
        }
        Glide.with(this).onTrimMemory(level);
    }
}
